Skip to main content

Basic Commands

The SDK commands below are designed to conduct basic SDK operations:

Set API domain​

Sets the SDK to use your back-end's domain name. Please head to https://app.vpnwholesaler.com/credentials in order to retrieve your API base domain name.

Important:

Please use the domain name only without scheme (i.e. do not include https://)

Login required: No

CmdProc Code: OVS_CMD_SET_API_DOMAIN

Command number: 9

Input:

{
"api_domain": "your_subdomain.vpngn.com",
"csid": "your_client_side_api_key"
}

Response: OVS_NOTIFY_SET_API_DOMAIN

Successful response
OVS_ERR_OK
data is null

Code sample:

vpnsdk.CmdProc(.OVS_CMD_SET_API_DOMAIN, ["api_domain": "your_subdomain", "csid": "your_client_side_api_key"])

Login​

Logins to the back-end and retrieves active products associated with the given user.

Login required: No

CmdProc Code: OVS_CMD_LOGIN

Command number: 1

Input:

Username and Pasword

{
"username": "end_user_email_address",
"password": "end_user_password"
}

end_user_email_address - End-user's username

end_user_password - End-user's password

Short token

{
"username": "$$short_token$$",
"password": "user_short_token"
}

user_short_token - End user's short token

Response: OVS_NOTIFY_LOGIN

OVS_NOTIFY_LOGIN Successful response

OVS_ERR_OK
Data contains information about user account and account status:
nextduedate - Plan renewal date
username - OpenVPN username
password - OpenVPN password
status - Account status
name - User's first name
email - User's email address
debug - Debug mode?
free - Free plan?

OVS_NOTIFY_LOGIN Failed response

OVS_ERR_WEB_API
OVS_ERR_RESP_INVALID
OVS_ERR_LOGIN_FAILED
OVS_ERR_NO_ACTIVE_PLAN - after receiving this response it is still possible to use user management functions.
However, VPN functions are unavailable until the end-user is logged-in with an active plan (it is recommended to invoke Logout method before logging-in).
data contains a human readable error description

Code sample:

vpnsdk.CmdProc(.OVS_CMD_LOGIN, ["username": "username", "password": "password"])

Logout​

Logs out a currently logged-in end-user.

Login required: Yes

CmdProc Code: OVS_CMD_LOGOUT

Command number: 38

Input: Not required

Response: OVS_NOTIFY_LOGOUT

OVS_NOTIFY_LOGOUT Successful response

OVS_ERR_OK
data is null

OVS_NOTIFY_LOGOUT Failed response

OVS_ERR_LOGOUT
data contains a human readable error description

Code sample:

vpnsdk.CmdProc(.OVS_CMD_LOGOUT, [:])